<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>系统参数列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="0"/>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
    <meta http-equiv="description" content="This is my page"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/easyUI/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/publicStyle.css"/><!--分页样式-->
</head>
<body style="overflow: hidden; width: 98%; height: 100%;">
<!-- 工具按钮区 -->

<div class="panel panel-primary" style="padding-left: 5px;margin-top: 5px;">
    <div class="panel-heading" style="background-color: #11a9e2;">
        <label>系统参数列表</label>
    </div>
    <div class="panel-body">
        <table class="table table-bordered table-hover" style="margin-bottom: 0;">
            <thead>
            <tr style="font-size: 12px;" align="center">
                <th style="text-align: center;">编号</th>
                <th style="text-align: center;">名称</th>
                <th style="text-align: center;">值</th>
                <th style="text-align: center;">操作</th>
            </tr>
            </thead>
            <tbody id="data_info">

            </tbody>
        </table>

    </div>
    <!--分页条-->
    <div class="pager" id="pager"></div>
</div>

<div id="divDialog">
    <!-- 放置一个添加用户的界面  -->
    <iframe id="iframe" frameborder="0" style="width: 100%;height: 100%;"></iframe>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/jquery/jquery-migrate-1.2.1.min.js"></script>
<!--分页  -->
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.myPagination.js"></script>
<!-- 导入bootStrap的库 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/easyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/easyUI/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/layer/2.4/layer.js"></script>
<script type="text/javascript"src="${pageContext.request.contextPath}/resources/plugins/layer/2.4/LayConstant.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
      selSystem(1);
    });
    var pageSize = 6;
   function selSystem(pageNo){
        var params={"pageNo":pageNo,"pageSize":pageSize};
        var obj = $("#data_info");
        obj.empty();
        $.ajax({
            url:'${pageContext.request.contextPath}/systemParam/selSystemList.jspx',
            data:params,
            type:'post',
            dataType:'json',
            success:function(data){
                if(data.code==0){
                    var content = data.content[0].info,code="";
                    var pageCount = data.content[0].pagetotal;//总页数
                    if (content.length < 1) {
                        layer.msg("暂无数据", {icon: 5, time: LayUIConstant.TIP_TIME});
                    } else {
                        for (var i = 0; i < content.length; i++) {
                            var paramId = content[i].sysid;
                            code +=  '<tr id="dataTr_'+i+'" align="center">'+
                                    '<td>'+paramId+'</td>'+
                                    '<td>'+content[i].paramName+'</td>'+
                                    '<td>'+content[i].paramValue+'</td>'+
                                    '<td>'+
                                    '<button type="button" class="btn btn-primary" onclick= "updateSystemValue(\'' + paramId + '\')">编辑</button>'+
                                    '</tr>';
                        }
                        obj.append(code);
                        if (pageCount > 0) {
                            //分页
                            $("#pager").myPagination({
                                currPage: pageNo, //初始选择的页数
                                pageCount: pageCount,//总页数
                                pageSize: pageSize //显示多少页
                            });
                        }
                    }
                }else{
                    layer.msg(data.message, {icon: 5, time: LayUIConstant.TIP_TIME});
                }
            },
            error:function(data){
                layer.msg("请求异常!", {icon: 5, time: LayUIConstant.TIP_TIME});
            }
        });
    }
    function pageOnClick(page) {
    	selSystem(page);
    }
    //分页文本框中直接输入时触发： properchange：适用IE9以及以上版本  onchange：IE不适用  两者必须有获取焦点失去焦点后才能触发
    function inputChange() {
        var pageNo = $('#pageInput').val();//文本框中当前页
        selSystem(pageNo);
    }

    //修改系统参数
    function updateSystemValue(paramId) {
        $('#divDialog').dialog({
            title: "修改系统参数", // 标题
            cls: "easyui-dialog", // class
            width: 480, // 宽度
            height: 265, // 高度
            maximizable: true, // 最大化
            minimizable: false, // 最小化
            collapsible: true, // 可伸缩
            modal: true, // 模态窗口
            onClose: function () { // 关闭窗口
                selSystem(1);
            }
        });
        //通过iframe来引入一个修改用户的页面
        $("#iframe").attr("src", "${pageContext.request.contextPath}/systemParam/updateSystemValue.jspx?paramId="+paramId);
    }

</script>


</body>

</html>





































